package com.ego.item.mapper;

import com.ego.item.pojo.Category;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.ids.SelectByIdsMapper;

import java.util.List;

public interface CategoryMapper extends Mapper<Category>,SelectByIdsMapper<Category>, SelectByIdListMapper<Category,Long> {
    @Delete("delete from tb_category_brand where category_id = #{cid}")
    void deleteCategoryBrand(@Param("cid") Long id);


    @Select("select * from tb_category where id in (select category_id from tb_category_brand where brand_id = #{bid})")
    List<Category> getListByBrandId(@Param("bid") Long bid);

    @Delete("delete from tb_specification where category_id = #{cid}")
    void deleteCategorySpecification(@Param("cid") Long id);
}
